import request from '@/utils/request'

// 查询客户列表
export function listCustomer(query) {
  return request({
    url: '/erp/customer/list', // 后端接口地址
    method: 'get',
    params: query
  })
}
// 新增客户
export function addCustomer(data) {
  return request({
    url: '/erp/customer/add',
    method: 'post',
    data: data
  })
}

// 修改客户
export function updateCustomer(data) {
  return request({
    url: '/erp/customer/update',
    method: 'put',
    data: data
  })
}

// 查看客户
export function getCustomer(customerId) {
  return request({
    url: `/erp/customer/view/${customerId}`,
    method: 'get'
  })
}
// 检查客户是否关联其他表
export function checkCustomerRelation(customerId) {
  return request({
    url: `/erp/customer/checkRelation/${customerId}`,
    method: 'get'
  })
}
//启用客户
export function enableCustomer(customerId) {
  return request({
    url: `/erp/customer/enable/${customerId}`,
    method: 'put',
    data: customerId
  })
}
//禁用客户
export function disableCustomer(customerId) {
  return request({
    url: `/erp/customer/disable/${customerId}`,
    method: 'put'
  })
}
